package com.zxmzy.scaffold.core.utils

import android.content.pm.ActivityInfo
import android.content.res.Configuration
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentActivity

/**
 * @author zhangxiaoming
 * @date 2023/8/10
 * @description
 */
object ScreenUtils {
    fun isPortrait(): Boolean {
        return appContext.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
    }

    fun isLandscape(): Boolean {
        return appContext.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
    }

    fun setLandscape(activity: AppCompatActivity) {
        activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
    }
}